var arr = [2, 1, 1, 2, 3, 3, 2, 2, 2, 1];

var sequenceLength = 1;
var sequenceElement = arr[0];
var bestSequenceLength = 1;
var bestSequenceElement = arr[0];

for (var i = 1; i < arr.length; i++)
{
    if (arr[i] === sequenceElement)
    {
        sequenceLength++;

        if (sequenceLength > bestSequenceLength)
        {
            bestSequenceLength = sequenceLength;
            bestSequenceElement = arr[i];
        }
    }
    else
    {
        sequenceLength = 1;
        sequenceElement = arr[i];
    }
}

for (var i = 0; i < bestSequenceLength; i++)
{
    console.log(bestSequenceElement);
}